package ar.edu.uba.fi.jmit.monitorengine.backend.server.mock;

import java.util.LinkedList;
import java.util.List;

import org.apache.log4j.Logger;

import ar.edu.uba.fi.jmit.monitorengine.backend.client.VisualizersService;
import ar.edu.uba.fi.jmit.monitorengine.backend.shared.dto.VisualizerDTO;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class VisualizersServiceMock extends RemoteServiceServlet implements VisualizersService {

	private static final long serialVersionUID = -4950227557878232423L;

	@Override
	public LinkedList<VisualizerDTO> getLoadedVisualizers() {
		Logger.getLogger(this.getClass()).info("getLoadedVisualizers");
		LinkedList<VisualizerDTO> list = new LinkedList<VisualizerDTO>();
		for(int i = 0; i<5;i++) {
			VisualizerDTO visualizer = new VisualizerDTO();
			visualizer.setName("mockName" + i);
			visualizer.setConnectionUrl("http://10.0.0." + i + ":8080/visualizer" + i);
			List<String> monitors = new LinkedList<String>();
			for(int j = 0; j < i; j++) {
				monitors.add("monitor" + (j+1) * i);
			}
			visualizer.setMonitors(monitors);
			list.add(visualizer);
		}
		return list;
	}

	
}
